<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .li_level1 {
            float: left;
            width: 200px;
            text-align: center;
        }
    </style>
    <script>
        function init() {
            let abuttons = document.querySelectorAll(".btn_a");
            [...abuttons].forEach((item) => {
                item.addEventListener("click", (event) => {
                    event.preventDefault();
                    let url = item.href.substring(item.href.lastIndexOf("/") + 1);
                    console.log(url);
                    switch (url) {
                        case "emp":
                            document.getElementById("insertPoint").innerHTML = "普通员工界面";
                            break;
                        case "manager":
                            document.getElementById("insertPoint").innerHTML = "管理员工界面";
                            break;
                    }
                    history.pushState({}, "", url);
                }, false);
            });
        }
        window.addEventListener("load", init, false);
    </script>
</head>

<body>
    <ul style="list-style:none">
        <li class="li_level1">
            <a class="btn_a" href="emp">员工</a>
        </li>
        <li class="li_level1">
            <a class="btn_a" href="manager">管理员</a>
        </li>
    </ul>
    <br>
    <hr>
    <div id="insertPoint"></div>
</body>

</html>